home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nejlepší hry
/
Nejlepsi hry.iso
/
hry
/
sea of chaos
/
sea_install.msi
/
_15C39AAA7726369D39812BD40F01CF6A
/
_820D75B480154A84B8F50E290C441B28
< prev
next >
Wrap
Text File
|
2004-11-24
|
1KB
|
63 lines
//simple shader to clip any pixels with a Z coordinate below the water plane
//handles 2 directional lights and ambient
//must be used with clipZ_lit.psh
//Luke Lenhart
//(C)2004-2005 Digipen Institute of Technology
//world,view,projection transform
float4x4 matWorldViewProj;
float4x4 matWorld;
//2 directional lights
float4 l1Direction;
float4 l1Color;
float4 l2Direction;
float4 l2Color;
//ambient light
float4 lAmbient;
//shader input
struct VS_INPUT
{
float4 Pos : POSITION;
float4 Normal : NORMAL;
float2 Tex0 : TEXCOORD0;
};
//shader output
struct VS_OUTPUT
{
float4 Pos0 : POSITION;
float4 Pos1 : TEXCOORD1;
float2 Tex0 : TEXCOORD0;
float4 Color : COLOR;
};
//shader code
VS_OUTPUT VShader(VS_INPUT In)
{
VS_OUTPUT Out;
//calc colors from directional lights
float4 l1Contrib=dot(-In.Normal,l1Direction)*l1Color;
l1Contrib=saturate(l1Contrib);
float4 l2Contrib=dot(-In.Normal,l2Direction)*l2Color;
l2Contrib=saturate(l2Contrib);
Out.Color=l1Contrib + l2Contrib + lAmbient;
Out.Color.a=1.0f;
//copy tex coord
Out.Tex0=In.Tex0;
//calc transformed position
Out.Pos0=mul(matWorldViewProj,In.Pos);
Out.Pos1=mul(matWorld,In.Pos);
//spit out the results
return Out;
}